import { PeaceColumnFieldNameEnum } from '@/enum/PeaceColumnEnum'
import { PeaceColumn } from '@/components/type/PeaceColumn'
import { ArrayUtil } from '@/util/ArrayUtil'

export const markFun = (peaceItem: PeaceColumn, columnIndex: number, numIndex: number) => {
  peaceItem[PeaceColumnFieldNameEnum.COLUMN_INDEX] = columnIndex
  peaceItem[PeaceColumnFieldNameEnum.NUM_INDEX] = numIndex
}
export const ifFilterUndefinedRepeatNum = (ele: PeaceColumn) => {
  return !ifFilterRepeatNum(ele)
}
export const ifFilterRepeatNum = (ele: PeaceColumn) => {
  return ele.filterConfig?.repeatRender && ele.filterConfig?.repeatRender.num
}

export const ifSaveUndefinedRepeatNum = (ele: PeaceColumn) => {
  return !ifSaveRepeatNum(ele)
}
export const ifSaveRepeatNum = (ele: PeaceColumn) => {
  return ele.saveConfig?.repeatRender && ele.saveConfig?.repeatRender.num
}

export const ifFilterRepeatNumAndEmptyFiledNames = (ele: PeaceColumn) => {
  return ele.filterConfig?.repeatRender && ele.filterConfig?.repeatRender.num && ArrayUtil.isEmpty(ele.filterConfig?.repeatRender.fieldNames)
}
